file = open("F:/桌面/章节.txt",encoding="utf-8")
content =file.read()
file.close()
file = open("F:/桌面/章节.txt",encoding="utf-8")
list =file.readlines()
for i in range(len(list)) :

    if not list[i].__contains__("html"):
        split = list[i-1].split("/")
        str1 = split[len(split)-1].split(".html")[0]
        str2 = str(int(str1)+1)
        str3 =list[i-1].replace(str1,str2)
        str3 = str3.replace(str3.split("     ")[1],list[i].split(" ")[1])
        content = content.replace(list[i],str3)
file.close()

file = open("F:/桌面/章节2.txt","w",encoding="utf-8")
file.write(content)
file.close()
